package yixaun.tim.service.impl;

import yixaun.tim.bean.group.CreateGroupVo;
import yixaun.tim.bean.group.GroupInfo;
import yixaun.tim.common.TimException;
import yixaun.tim.service.TimGroupService;
import yixaun.tim.service.TimService;
import yixaun.tim.util.JsonUtils;

/**
 * @author yixuan
 * @date 2020/7/20
 */
public class TimGroupServiceImpl implements TimGroupService {

    private TimService timService;

    public TimGroupServiceImpl(TimService timService) {
        this.timService = timService;
    }

    @Override
    public CreateGroupVo createGroup(GroupInfo groupInfo) throws TimException {

        String api = "v4/group_open_http_svc/create_group";

        return JsonUtils.fromJson(this.timService.post(api, groupInfo), CreateGroupVo.class);
    }
}
